/*
 * Copyright (c) 2012 Sqpoll.
 * All rights reserved.
 */
package com.sqpoll.survey.dao;

import java.util.List;
import java.util.Map;

import com.sqpoll.survey.model.AnswerChoice;
import com.sqpoll.survey.model.Question;
import com.sqpoll.survey.model.QuestionItem;
import com.sqpoll.survey.model.Survey;

/**
 * An interface for survey mapper.
 * 
 * @author Younggue Bae
 */
public interface SurveyMapper {

	/**
	 * Gets a survey.
	 * 
	 * @param surveyId
	 *          the surveyId
	 * @return Survey the survey
	 */
	public Survey selectSurvey(int surveyId);

	/**
	 * Gets the survey list
	 * 
	 * @param parameters
	 *          the parameters
	 * @return List<Survey> the survey list
	 */
	public List<Survey> selectSurveys(Survey parameters);

	/**
	 * Inserts a survey.
	 * 
	 * @param survey
	 *          the survey
	 * @return
	 */
	public int insertSurvey(Survey survey);
	
	/**
	 * Updates the survey.
	 * 
	 * @param survey
	 *          the survey
	 * @return
	 */
	public int updateSurvey(Survey survey);

	/**
	 * Trashes a survey.
	 * 
	 * @param parameters
	 *          the parameters(surveyId and userId)
	 * @return
	 */
	public int trashSurvey(Map<String, Object> parameters);

	/**
	 * Deletes a survey permanently.
	 * 
	 * @param surveyId
	 *          the survey id
	 * @return
	 */
	public int deleteSurvey(int surveyId);
	
	
	/**
	 * Gets a question.
	 * 
	 * @param parameters
	 *          the parameters(surveyId, questionId)
	 * @return Question the question
	 */
	@SuppressWarnings("rawtypes")
	public Question selectQuestion(Map parameters);

	/**
	 * Gets the question list.
	 * 
	 * @param surveyId
	 *          the survey id
	 * @return List<Question> the question list of survey
	 */
	public List<Question> selectQuestions(int surveyId);
	
	/**
	 * Gets the question items of a question.
	 * 
	 * @param parameters
	 *          the parameters(surveyId, questionId)
	 * @return List<QuestionItem> the question items
	 */
	@SuppressWarnings("rawtypes")
	public List<QuestionItem> selectQuestionItems(Map parameters);
	
	/**
	 * Gets the answer choices of a question.
	 * 
	 * @param parameters
	 *          the parameters(surveyId, questionId)
	 * @return List<AnswerChoice> the answer choices
	 */
	@SuppressWarnings("rawtypes")
	public List<AnswerChoice> selectAnswerChoices(Map parameters);

	/**
	 * Inserts a question.
	 * 
	 * @param question
	 *          the question
	 */
	public void insertQuestion(Question question);
	
	/**
	 * Inserts a question item of a question.
	 * 
	 * @param questionItem
	 *          the question item
	 */
	public void insertQuestionItem(QuestionItem questionItem);
	
	/**
	 * Inserts a answer choice of a question.
	 * 
	 * @param answerChoice
	 *          the answer choice
	 */
	public void insertAnswerChoice(AnswerChoice answerChoice);
	
	/**
	 * Updates the question.
	 * 
	 * @param question
	 *          the question
	 */
	public void updateQuestion(Question question);

	/**
	 * Deletes the question.
	 * 
	 * @param parameters
	 *          the parameters(surveyId, questionId)
	 */
	@SuppressWarnings("rawtypes")
	public void deleteQuestion(Map parameters);
	
	/**
	 * Deletes the question items.
	 * 
	 * @param parameters
	 *          the parameters(surveyId, questionId)
	 */
	@SuppressWarnings("rawtypes")
	public void deleteQuestionItems(Map parameters);
	
	/**
	 * Deletes the answer choices.
	 * 
	 * @param parameters
	 *          the parameters(surveyId, questionId)
	 */
	@SuppressWarnings("rawtypes")
	public void deleteAnswerChoices(Map parameters);

}
